package com.cn.controller;

import com.cn.api.ApiResult;
import com.cn.pojo.DTO.ShopCommentDTO;
import com.cn.pojo.shop.ShopComment;
import com.cn.service.ShopCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 评论表数据信息
 */
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private ShopCommentService shopCommentService;

    /**
     * 统计评价数据信息
     * @return
     */
    @GetMapping("/queryComment")
    private ApiResult queryComment(){
        return shopCommentService.queryComment();
    }


    /**
     * 修改数据
     * @param shopComment
     * @return
     */
    @PutMapping("/updateComment")
    private ApiResult updateComment(@RequestBody ShopCommentDTO shopCommentDTO){
        return shopCommentService.updateComment(shopCommentDTO);
    }

    /**
     * 删除评论信息
     * @param id
     * @return
     */
    @DeleteMapping("/deleteComment/{id}")
    private  ApiResult deleteComment(@PathVariable("id") Integer id){
        return shopCommentService.deleteComment(id);
    }
}
